package com.servlet.user;

import com.enitiy.User;
import com.service.user.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 创建作者 ：MySunshine
 * 创建时间 2022/10/28 12:08
 * 项目名称 SHUSHAN
 */
@WebServlet("/UserUpdateByNum")
public class UserUpdateByNum extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int num = Integer.parseInt(req.getParameter("num"));
        String name = req.getParameter("name");
        String pwd = req.getParameter("pwd");
        int age = Integer.parseInt(req.getParameter("age"));
        String sex = req.getParameter("sex");
        String phone = req.getParameter("phone");
        int kid = Integer.parseInt(req.getParameter("kid"));
        System.out.println(kid);
        UserServiceImpl usi = new UserServiceImpl();
        boolean b = usi.UserUpdateByNum(new User(num, name, pwd, age, sex, phone, kid));
        if (b){
            System.out.println("修改成功！");
            resp.sendRedirect("/page/dba/dbaUserMge.jsp");
        }else {
            System.out.println("修改失败！");
        }
    }
}
